const express = require('express')
const cors = require('cors')
const app = express()
app.listen(9516,()=>{
	console.log('9516 success!')
})
app.use(cors({
    origin:['http://localhost:8848','http://127.0.0.1:8848',
			'http://localhost:5500','http://127.0.0.1:5500',
			'http://localhost:8080','http://127.0.0.1:8080'],
    methods:['GET','POST','DELETE','PUT'],
    alloweHeaders:['Content-Type','Authorization']
}))

const LI = require('./routers/LogIn.js')
app.use(express.urlencoded({
	extended:true
}))
express.static('../temporary')
app.use('/v1/user',LI)



app.use((err,req,res,next)=>{
	if (err){
		console.log(err)
		res.send({code:502,msg:'服务器端错误'})
	}
})